In [1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
In [3]:
app = pd.read_pickle('/Users/krystal/Desktop/app_cleaned.pickle')
app.head()
Out[3]:
In [ ]:
app = app.drop_duplicates()
In [6]:
app.dtypes.index
Out[6]:
In [13]:
data_q3 = app[np.isfinite(app['current_rating']) & np.isfinite(app['is_InAppPurcased'])]
Question 3 Is there any difference in app quality for free apps with in-app purchases?
In [22]:
data_q3['is_InAppPurcased'].value_counts()
Out[22]:
In [24]:
free = data_q3.loc[data_q3['is_InAppPurcased'] == 0]
paid = data_q3.loc[data_q3['is_InAppPurcased'] == 1]
free['current_rating'].plot(kind = "density")
paid['current_rating'].plot(kind = "density")
plt.xlabel('Current Rating')
plt.legend(labels = ['free','paid'], loc='upper right')
plt.title('Distribution of current rating among free/paid apps')
plt.show()
First, the data set is splitted into two parts, one is app without in-app purchases and another is app with in-app purchases. Then the density plots for the two subsets are made and from the plots we can see that the current rating of paid app is generally higher than the overall rating of free app. Some specific tests are still needed to perform.
In [25]:
import scipy.stats
In [26]:
free = list(free['current_rating'])
paid = list(paid['current_rating'])
In [27]:
print(np.mean(free))
print(np.mean(paid))
In [28]:
scipy.stats.ttest_ind(free, paid, equal_var = False)
Out[28]:
I perform t test here. We have two samples here, one is free apps and another is apps with in-app purchases. So I want to test whether the mean current rating for these two samples are different.
The null hypothesis is mean current rating for free apps and mean current rating for apps with in-app purchases are the same and the alternative hypothesis is that the mean current rating for these two samples are not the same.
From the result we can see that the p value is 2.5715670717150474e-38, which is smaller than 0.05, so we should reject null hypothesis at significance level 0.05, that is, we should conclude that the mean of current rating for these two samples are not the same and with in-app purchases or not do influent the rating of an app.
In [29]:
scipy.stats.f_oneway(free, paid)
Out[29]:
I also perform one-way ANOVA test here.
The null hypothesis is mean current rating for free apps and mean overall rating for apps with in-app purchases are the same and the alternative hypothesis is that the mean current rating for these two samples are not the same.
From the result we can see that the p value is 9.7392843155192399e-37, which is smaller than 0.05, so we should reject null hypothesis at significance level 0.05, that is, we should conclude that the mean of current rating for these two samples are not the same and with in-app purchases or not do influent the rating of an app.
In [30]:
scipy.stats.kruskal(free, paid)
Out[30]:
I perform Kruskal-Wallis H-test here, which is a non-parametric version of ANOVA. Since t test and one-way ANOVA test all need assumption that the samples shoule come from a normally distributed population, here we use this test, which do not need these assumptions but will lose some power.
The null hypothesis is mean current rating for free apps and mean current rating for apps with in-app purchases are the same and the alternative hypothesis is that the mean current rating for these two samples are not the same.
From the result we can see that the p value is 1.1903303041683057e-29, which is smaller than 0.05, so we should reject null hypothesis at significance level 0.05, that is, we should conclude that the mean of current rating for these two samples are not the same and with in-app purchases or not do influent the rating of an app.
In general, from the results in these three tests, we can conclude that whether providing in-app purchases can influent the rating of an app and the association needs further exploration.
In [ ]: